package com.panda.business.controller.user;

import com.panda.business.domain.AccountInfo;
import com.panda.business.domain.req.CommontagVo;
import com.panda.business.service.DepartmentService;
import com.panda.business.domain.CommontagInfo;
import com.panda.business.domain.DepartmentInfo;
import com.panda.business.service.CommontagService;
import com.panda.framework.domain.base.PageBean;
import com.panda.framework.util.SessionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/user/commontag")
public class CommontagController {
	
	@Autowired
	private CommontagService service;
   
    /**
     * 信息修改
     * @param user
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/edit" ,method = RequestMethod.POST)
    public String edit(CommontagInfo user,HttpServletRequest request){
    	AccountInfo info = SessionUtil.getAccountInfo(request);
    	user.setCid(info.getCid());
    	return service.update(user);
    }
    
    /**
     * 信息添加
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/add" ,method = RequestMethod.POST)
    public String add(CommontagInfo user,HttpServletRequest request){
    	AccountInfo info =  SessionUtil.getAccountInfo(request);
    	user.setCid(info.getCid());
    	return service.insert(user);
    }
}
